// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ICloudStorageAccountManager.cs" company="AzureContrib (Open source library http://azurecontrib.codeplex.com)">
//   Microsoft Public License (Ms-PL)
// </copyright>
// <summary>
//   Exception for errors when handling Windows Azure Cloud Drives.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;

using Microsoft.WindowsAzure;

namespace AzureContrib.WindowsAzure.StorageClient
{
	/// <summary>
	/// A mangera to access <see cref="ICloudStorageAccount"/> instances.
	/// </summary>
	public interface ICloudStorageAccountManager
	{
		/// <summary>
		/// Get a <see cref="ICloudStorageAccount"/> given a special named context.
		/// </summary>
		/// <param name="context">The named data context you use to abstract away from any particular <see cref="CloudStorageAccount"/></param>
		/// <returns>A <see cref="CloudStorageAccount"/> wrapped up in an <see cref="ICloudStorageAccount"/></returns>
		/// <remarks>If there is no context registered and the context name is a config settin this method will <see cref="CloudStorageAccount.TryParse"/> an account from that value.</remarks>
		/// <exception cref="KeyNotFoundException">If the <paramref name="context"/> is not a registered storage context. <seealso cref="AddCloudStorageAccount(string,ICloudStorageAccount)"/> and <seealso cref="AddCloudStorageAccount(string,string)"/>.</exception>
		ICloudStorageAccount GetStorageAccount(string context);

		/// <summary>
		/// Add a data context to a registry of such contexts <seealso cref="ICloudStorageAccountManager"/>.
		/// </summary>
		/// <param name="context">The name of the data context.</param>
		/// <param name="cloudStorageAccount">The way to access the account.</param>
		void AddCloudStorageAccount(string context, ICloudStorageAccount cloudStorageAccount);

		/// <summary>
		/// Add a data context to a registry of such contexts <seealso cref="ICloudStorageAccountManager"/>.
		/// </summary>
		/// <param name="context">The name of the data context.</param>
		/// <param name="connectionString">The valid connection string to a <see cref="CloudStorageAccount"/></param>
		/// <exception cref="ArgumentOutOfRangeException">If the <paramref name="connectionString"/> does not parse to a <see cref="CloudStorageAccount"/></exception>
		void AddCloudStorageAccount(string context, string connectionString);
	}
}